1. Field
The present embodiments relate to method resolution in object-oriented programming languages. More specifically, the present embodiments relate to techniques for resolving method calls to virtual extension methods declared in interface types of object-oriented programming languages.
2. Related Art
Extension methods in object-oriented programming languages may possibly enable the addition of methods to an existing type without creating a new type, recompiling the existing type, and/or otherwise modifying the existing type. For example, use of extension methods within interfaces may facilitate the evolution of the interfaces without requiring the addition of method implementations corresponding to the extension methods to all classes implementing the interfaces.
However, naming conflicts may exist among extension methods and/or method implementations. For example, two different method implementations with the same method signature may be provided by a class implementing an interface and an extension method associated with the interface. In addition, such naming conflicts may not be recognized by compilers, potentially resulting in subtle, hard-to-detect bugs. For example, a receiving class may implement two interfaces containing extension methods with the same method signature. During execution, a method call with the same method signature as that of the extension methods may be resolved using an extension method from the first interface at one call site and a different extension method from the second interface at a different call site, thus causing two different method implementations to be used in resolving the same method call.
Hence, what is needed is a mechanism for consistently resolving naming conflicts associated with extension methods in programming languages.